package main

import (
	"encoding/gob"
	"flag"
	"fmt"
	"github.com/olivere/elastic/v7"
	"luiz/crawler/model"
	"luiz/crawler_distributed/persist"
	"luiz/crawler_distributed/prcsupport"
)

var port = flag.Int("port", 0, "the port for me to listen")

func main() {
	flag.Parse()
	client, _ := elastic.NewClient(elastic.SetURL("http://124.71.171.6:9200/"))
	fmt.Printf("listen:%v", *port)
	gob.Register(model.House{})
	err := prcsupport.ServeRpc(fmt.Sprintf(":%d", *port), &persist.ItemSaverService{Client: client, Index: "ppop"})

	if err != nil {
		panic(err)
	}
}
